package com.example.administrator.videoplay;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.example.app.activity.Video5Activity;
import com.example.app.activity.VideoActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView videoTypeTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        videoTypeTv = (TextView) findViewById(R.id.video_type_tv);
        findViewById(R.id.video_1_bt).setOnClickListener(this);
        findViewById(R.id.video_5_bt).setOnClickListener(this);
        findViewById(R.id.video1_bt).setOnClickListener(this);
        findViewById(R.id.video2_bt).setOnClickListener(this);
        findViewById(R.id.video3_bt).setOnClickListener(this);
        findViewById(R.id.video4_bt).setOnClickListener(this);
    }

    Class<?> cls = VideoActivity.class;

    @Override
    public void onClick(View v) {
        String type = "0";
        switch (v.getId()) {
            case R.id.video_1_bt:
                cls = VideoActivity.class;
                videoTypeTv.setText("5.0 以下");
                return;
            case R.id.video_5_bt:
                cls = Video5Activity.class;
                videoTypeTv.setText("5.0");
                return;
            case R.id.video1_bt:
                //5.0 横屏 90
                type = "1";

                break;
            case R.id.video3_bt:
                //5.0 横屏 270
                type = "2";

                break;
            case R.id.video2_bt:
                //5.0 竖屏 0
                type = "3";

                break;
            case R.id.video4_bt:
                //5.0 竖屏 180
                type = "4";
                break;
            default:
                return;
        }
        Intent it = new Intent();
        it.setClass(this, cls);
        it.putExtra("arg0", type);
        startActivity(it);
    }
}
